.PHONY: init
# generate "./docker-compose.yml.example" + "./components/caddy/.env" + "./components/vaultwarden/.env"
init:
	awk 'BEGIN { cmd="cp -ri docker-compose.yml.example docker-compose.yml"; print "n" |cmd; }'
	awk 'BEGIN { cmd="cp -ri ./components/caddy/.env.example ./components/caddy/.env"; print "n" |cmd; }'
	awk 'BEGIN { cmd="cp -ri ./components/vaultwarden/.env.example ./components/vaultwarden/.env"; print "n" |cmd; }'

# show help
help:
	@echo ''
	@echo 'Usage:'
	@echo ' make [target]'
	@echo ''
	@echo 'Targets:'
	@awk '/^[a-zA-Z0-9_-]+:/ { \
	helpMessage = match(lastLine, /^# (.*)/); \
		if (helpMessage) { \
			helpCommand = substr($$1, 0, index($$1, ":")-1); \
			helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
			printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \
		} \
	} \
	{ lastLine = $$0 }' $(MAKEFILE_LIST)

.DEFAULT_GOAL := help